package com.xiaoh.leetcode.easy;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xiaoh
 * @ClassName KidsWithCandies_1431
 * @Description 1431. 拥有最多糖果的孩子
 * @Date 2021/1/11 上午10:49
 * @Version 1.0
 */
public class KidsWithCandies_1431 {

    public static List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
        List<Boolean> result = new ArrayList<Boolean>();
        int max = candies[0];
        for (int i = 0; i < candies.length; i++) {
            if (candies[i] > max) {
                max = candies[i];
            }
        }
        for (int i = 0; i < candies.length; i++) {
            if (candies[i] + extraCandies >= max) {
                result.add(true);
            } else {
                result.add(false);
            }
        }
        return result;
    }

    public static void main(String[] args) {
        int[] candies = {4,2,1,1,2};
        int extraCandies = 1;
        List<Boolean> result = kidsWithCandies(candies, extraCandies);
        System.out.println(result);
    }
}
